<template>
  <div>
    <van-field  label='用户名' v-model='form.name'/>
    <van-field  label='密码' v-model='form.password'/>
    <van-button @click='login'>登录</van-button>


  </div>
</template>

<script>
import myaxios from "@/http/axios";

export default {
  name: "slogin",
  data() {
    return {
      data1: '',
      form:{}
    }
  },
  methods: {
    // setInterval(handler, timeout) {
    // }
    login(){
      myaxios('userlogin','post',this.form).then(res=>{
        //存储用户名和资源信息
        localStorage.setItem('uid',res.userid)
        localStorage.setItem('uname',res.name)
        localStorage.setItem('resourcelist',JSON.stringify(res.resourcelist))
        this.$router.push('menu')
      })
    }
  },
  mounted() {

  }
}
</script>

<style scoped>

</style>